package com.itcam;

import java.lang.reflect.InvocationTargetException;
import java.util.Properties;

/**
 * @author : Cammy.Wu
 * Description : 神器的妙用（反射应用）
 */

public class Demo03 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Class<?> clazz = Class.forName("com.itcam.Sword");
        Sword weapon = (Sword) clazz.getDeclaredConstructor().newInstance();
        weapon.attack();

    }
}

interface Weapon {
    void attack();
}

class Sword implements Weapon {
    public void attack() {
        System.out.println("剑气纵横！");
    }
}
